<template>
    <div class="app-container">
        <el-tabs v-model="activeName">
            <el-tab-pane label="工序设置" name="first">
                <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
                    <pane size="16">
                <!-- <el-row :gutter="20"> -->
                <el-col >
                <el-tree   
                    :data="processDataTree" 
                    :props="defaultProps" 
                    highlight-current=true
                    default-expand-all=true
                    expand-on-click-node
                    @node-click="handleNodeClick1">
                </el-tree>
            </el-col>
            </pane>
            <pane size="84">
            <el-col >
                <el-form ref="processData" :model="processData" size="small">
                    <h2 align="center">工序资料</h2>
                    <el-row :gutter="10" class="mb8">
                        <el-col>
                            <el-button
                            icon="el-icon-plus"
                            plain
                            size="mini"
                            type="primary"
                            @click="handleAddProcess">新增工序</el-button>
                        </el-col>
                    </el-row>
                    <el-row :gutter="10">
                        <el-col :span="12">
                        <el-form-item label="工序名称">
                            <el-input v-model="processData.GXMC"/>
                        </el-form-item>
                        </el-col>
                        <el-col :span="12">
                        <el-form-item label="附加代号">
                            <el-input v-model="processData.FJDH"/>
                        </el-form-item>
                        </el-col>
                    </el-row>
                    
                <el-row :gutter="10">
                    <el-col :span="12">
                    <el-form-item label="默认仓库">
                        <el-input v-model="processData.MRCK"/>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="废品单价">
                        <el-input v-model="processData.FPDJ"/>
                    </el-form-item>
                </el-col>
               
                </el-row>
                <el-row :gutter="10">
                    <el-col :span="12">
                    <el-form-item label="正品单价">
                        <el-input v-model="processData.ZPDJ"/>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="次品单价">
                        <el-input v-model="processData.CPDJ"/>
                    </el-form-item>
                </el-col>
                </el-row>
                <el-row :gutter="10">
                        <el-col :span="120">
                    <el-form-item label="加工顺序">
                        
                        <el-select v-model="processData.JGSX" clearable placeholder="请选择加工顺序" size="medium">
                            <el-option
                              v-for="dict in JGSXOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="120">
                    <el-form-item label="所属车间">
                        <!-- <el-input v-model="processData.SSCJ"/> -->
                        <el-select v-model="processData.SSCJ" clearable placeholder="请选择所属车间" size="medium">
                            <el-option 
                              v-for="dict in SSCJOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                              <!-- :value="parseInt(dict.dictValue)" -->
                        </el-select>
                    </el-form-item>
                </el-col>
                <!-- </el-row>
                <el-row :gutter="10"> -->
                    <el-col :span="120">
                    <el-form-item label="工序属性">
                        <!-- <el-input v-model="processData.GXSX"/> -->
                         <el-select v-model="processData.GXSX" clearable placeholder="请选择工序属性" size="medium">
                            <el-option 
                              v-for="dict in GXSXOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                         </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="120">
                    <el-form-item label="隶属于" prop="LSY">
                        <!-- <el-select v-model="LSY" clearable placeholder="请选择隶属于的工序">
                            <el-option
                              v-for="dict in LSYOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                        </el-select> -->
                        <treeselect
                          v-model="processData.LSY"
                          :options="LSYTreeOptions"
                          :show-count="true"
                          placeholder="请选择归属工序"
                          size="medium"
                          style="width: 260px"
                          @select="handleTreeChange"
                         />
                    </el-form-item>
                </el-col>
                </el-row>
                    <el-form-item >
                        <el-checkbox v-model="processData.CJGX">是否研磨车间工序</el-checkbox>
                    </el-form-item>
                </el-form>
            </el-col>
            <!-- 新增工序对话框 -->
             <el-dialog
                :title="titleProcess"
                :visible.sync="openProcess"
                append-to-body="append-to-body"
                width="1024px"
                >
            <el-form
                :model="processDialog"
                label-width="120px"
                >
                <el-row :gutter="10">
                        <el-col :span="12">
                        <el-form-item label="工序名称">
                            <el-input v-model="processDialog.GXMC"/>
                        </el-form-item>
                        </el-col>
                        <el-col :span="12">
                        <el-form-item label="附加代号">
                            <el-input v-model="processDialog.FJDH"/>
                        </el-form-item>
                        </el-col>
                    </el-row>
                    
                <el-row :gutter="10">
                    <el-col :span="12">
                    <el-form-item label="默认仓库">
                        <el-input v-model="processDialog.MRCK"/>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="废品单价">
                        <el-input v-model="processDialog.FPDJ"/>
                    </el-form-item>
                </el-col>
               
                </el-row>
                <el-row :gutter="10">
                    <el-col :span="12">
                    <el-form-item label="正品单价">
                        <el-input v-model="processDialog.ZPDJ"/>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="次品单价">
                        <el-input v-model="processDialog.CPDJ"/>
                    </el-form-item>
                </el-col>
                </el-row>
                <el-row :gutter="10">
                        <el-col :span="120">
                    <el-form-item label="加工顺序">
                        
                        <el-select v-model="processDialog.JGSX" clearable placeholder="请选择加工顺序" size="medium">
                            <el-option
                              v-for="dict in JGSXOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="120">
                    <el-form-item label="所属车间">
                        <!-- <el-input v-model="processData.SSCJ"/> -->
                        <el-select v-model="processDialog.SSCJ" clearable placeholder="请选择所属车间" size="medium">
                            <el-option 
                              v-for="dict in SSCJOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                              <!-- :value="parseInt(dict.dictValue)" -->
                        </el-select>
                    </el-form-item>
                </el-col>
                <!-- </el-row>
                <el-row :gutter="10"> -->
                    <el-col :span="120">
                    <el-form-item label="工序属性">
                        <!-- <el-input v-model="processData.GXSX"/> -->
                         <el-select v-model="processDialog.GXSX" clearable placeholder="请选择工序属性" size="medium">
                            <el-option 
                              v-for="dict in GXSXOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                         </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="120">
                    <el-form-item label="隶属于" prop="LSY">
                        <!-- <el-select v-model="LSY" clearable placeholder="请选择隶属于的工序">
                            <el-option
                              v-for="dict in LSYOptions"
                              :key="dict.dictValue"
                              :label="dict.dictLabel"
                              :value="dict.dictValue"/>
                        </el-select> -->
                        <treeselect
                          v-model="processDialog.LSY"
                          :options="LSYTreeOptions"
                          :show-count="true"
                          placeholder="请选择归属工序"
                          size="medium"
                          style="width: 260px"
                          @select="handleTreeChange"
                         />
                    </el-form-item>
                </el-col>
                </el-row>
                    <el-form-item >
                        <el-checkbox v-model="processDialog.CJGX">是否研磨车间工序</el-checkbox>
                    </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="submitFormProcess">确 定</el-button>
                    <el-button @click="cancelProcess">取 消</el-button>
                </div>
            </el-dialog>
        </pane>
                    <!-- </el-row> -->
                </splitpanes>
            </el-tab-pane>
            <el-tab-pane label="工艺设置" name="second">
                <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
                    <pane size="16">
                <!-- <el-row :gutter="20"> -->
                <el-col >
                <el-tree 
                    :data="baseCraftDataTree" 
                    :props="defaultProps"
                    highlight-current=true
                    default-expand-all=true
                    expand-on-click-node
                    @node-click="handleNodeClick2"
                    >
                </el-tree> 
                </el-col>
                </pane>
                <pane size="84">
                <el-col >
                <el-form ref="baseCraftTable" :model="baseCraftTable" size="mini">
                   <h2 align="center">基础工艺表</h2>
                    <el-row :gutter="10">
                        <el-col :span="8">
                        <el-form-item label="工艺编号">
                            <el-input v-model="baseCraftTable.GYBH"/>
                        </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="工艺名称">
                                <el-input v-model="baseCraftTable.GYMC"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="所属类别">
                                <!-- <el-input v-model="baseCraftTable.SSLB"/> -->
                                 <treeselect
                                 v-model="baseCraftTable.SSLB"
                          :options="SSLBTreeOptions"
                          :show-count="true"
                          placeholder="请选择归属工序"
                          size="medium"
                          style="width: 260px"
                          @select="handleTreeChange"
                         />
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>

                <el-row :gutter="10" class="mb8">
                    <el-col>
                        <el-button
                        icon="el-icon-plus"
                        plain
                        size="mini"
                        type="primary"
                        @click="handleAdd">
                    新增</el-button>
                    </el-col>
                </el-row>

                <el-row>
                    <el-table 
                        :data="productCraftFlowTableData"
                        border
                        style="width: 100%"
                        >
                        <el-table-column
                            prop="JGSX"
                            label="加工顺序"
                            width="100">
                        </el-table-column>
                        <el-table-column
                            prop="GXMC"
                            label="工序名称"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SSDGXYX"
                            label="受上道工序影响"
                            
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SDprocess"
                            label="上道工序"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SDGX"
                            label="首道工序"
                            
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GXSX"
                            label="工序属性"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="JGBM"
                            label="加工部门"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="JGJG"
                            label="加工价格"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="FPJG"
                            label="废品价格"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="DC"
                            label="单重"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="MDGX"
                            label="末道工序"
                    
                            width="120"></el-table-column>
                            <el-table-column
                            prop="XCGXSZ"
                            label="消除工序设置"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="WCL"
                            label="误差率%"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="DEGS"
                            label="定额工时"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GSDW"
                            label="工时单位"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GJGX"
                            label="关键工序"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="remark"
                            label="备注"
                            width="120"></el-table-column>
                            <el-table-column
                              align="center"
                              class-name="small-padding fixed-width"
                              fixed="right"
                              label="操作"
                              min-width="280">
                              <template slot-scope="scope">
                                <el-button
                                  icon="el-icon-edit"
                                  size="mini"
                                  type="text"
                                  @click="handleUpdate(scope.row)"
                                  >修改</el-button>
                                  <el-button
                                    icon="el-icon-delete"
                                    size="mini"
                                    type="text"
                                    @click="handleDelete(scope.row)"
                                    >删除</el-button>
                              </template>
                            </el-table-column>
                    </el-table>
                </el-row>
            </el-col>
        </pane>
        <!-- </el-row> -->
         </splitpanes>
            </el-tab-pane>
            <!-- 添加或修改工序数据对话框 -->
             <el-dialog
                :title="title"
                :visible.sync="open"
                append-to-body="append-to-body"
                width="1024px">
                <el-form
                    :model="GXDialog"
                    label-width="120px">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="加工顺序" prop="JGSX">
                            <el-input
                              v-model="GXDialog.JGSX"
                              placeholder="请输入加工顺序"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="工序名称" prop="GXMC">
                            <el-input
                              v-model="GXDialog.GXMC"
                              placeholder="请输入工序名称"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="受上道工序影响" prop="SSDGXYX">
                            <el-select
                              v-model="GXDialog.SSDGXYX"
                              clearable
                              placeholder="请选择是否受上道工序影响">
                            <el-option
                                v-for="dict in SSDGXYXOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="上道工序" prop="SDGX">
                            <el-input v-model="GXDialog.SDGX" placeholder="请输入上道工序"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="首道工序" prop="SDprocess">
                            <el-select
                              v-model="GXDialog.SDprocess"
                              clearable
                              placeholder="请选择是否为首道工序">
                            <el-option
                                v-for="dict in SSDGXYXOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="工序属性" prop="GXSX">
                            <!-- <el-input v-model="GXDialog.GXSX" placeholder="请输入工序属性"></el-input> -->
                             <el-select
                                v-model="GXDialog.GXSX"
                                clearable
                                placeholder="请选择工序属性">
                            <el-option
                                v-for="dict in GXSXOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="加工部门" prop="JGBM">
                            <treeselect
                                 v-model="GXDialog.JGBM"
                          :options="JGBMTreeOptions"
                          :show-count="true"
                          placeholder="请选择加工部门"
                          size="medium"
                          style="width: 260px"
                          @select="handleTreeChange"
                         />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="加工价格" prop="JGJG">
                            <el-input v-model="GXDialog.JGJG" placeholder="请输入加工价格"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="废品价格" prop="FPJG">
                            <el-input v-model="GXDialog.FPJG" placeholder="请输入废品价格"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="单重" prop="DC">
                            <el-input v-model="GXDialog.DC" placeholder="请输入单重"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="末道工序" prop="MDGX">
                            <el-select
                              v-model="GXDialog.MDGX"
                              clearable
                              placeholder="请选择是否为末道工序">
                            <el-option
                                v-for="dict in SSDGXYXOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="消除工序设置" prop="XCGXSZ">
                            <!-- <el-input v-model="GXDialog.XCGXSZ" placeholder="请输入消除工序设置"></el-input> -->
                            <el-select
                              v-model="GXDialog.XCGXSZ"
                              clearable
                              placeholder="请选择消除工序设置">
                            <el-option
                                v-for="dict in XCGXSZOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="误差率%" prop="WXL">
                            <el-input v-model="GXDialog.WCL" placeholder="请输入误差率"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="定额工时" prop="DEGS">
                            <el-input v-model="GXDialog.DEGS" placeholder="请输入定额工时"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="工时单位" prop="GSDW">
                            <el-input v-model="GXDialog.GSDW" placeholder="请输入工时单位"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="关键工序" prop="GJGX">
                            <el-select
                              v-model="GXDialog.GJGX"
                              clearable
                              placeholder="请选择是否为关键工序">
                            <el-option
                                v-for="dict in SSDGXYXOptions"
                                :key="dict.dictValue"
                                :label="dict.dictLabel"
                                :value="dict.dictValue"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="GXDialog.remark" placeholder="请输入备注" type="textarea"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="submitForm">确 定</el-button>
                    <el-button @click="cancel">取 消</el-button>
                </div>
             </el-dialog>
        
        <el-tab-pane label="产品工艺" name="third">
            <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
                <pane size="16">
            <!-- <el-row :gutter="20"> -->
                <el-col >
                <el-form :inline="true" :model="queryParamsCPGY" size="small">
                    <el-form-item label="产品条件">
                        <el-input v-model="queryParamsCPGY.CPTJ" placeholder="请输入产品条件"/>
                    </el-form-item>
                </el-form>
                <el-tree 
                    :data="productCraftDataTree" 
                    :props="defaultProps"
                    highlight-current=true
                    default-expand-all=true
                    
                    expand-on-click-node
                    @node-click="handleNodeClick3"
                    >
                </el-tree>
            </el-col>
            </pane>
            <pane size="84">
            <el-col >
            <!-- <el-row :gutter="20"> -->
            <!-- <div class="table-container" style="margin-bottom: 100px"> -->
                <h2 align="center">产品列表</h2>
                <el-tooltip placement="top">
                <div slot="content">点击任意一行列即可跳转查看产品工艺明细</div>
            <el-table
                    :data="productCraftData"
                    border
                    style="width:100%"
                    @row-click="handleCellClick"
                >
            <el-table-column
                prop="CPDH"
                label="产品代号"
                ></el-table-column>
                <el-table-column
                prop="CPMC"
                label="产品名称"
                ></el-table-column>
                <el-table-column
                prop="CPTH"
                label="产品图号"
                ></el-table-column>
                <el-table-column
                prop="CPGG"
                label="产品规格"
                ></el-table-column>
                <el-table-column
                prop="GXStatus"
                label="工序状态"
                width="120"></el-table-column>
            </el-table>
            </el-tooltip>
            <!-- </div>
            </el-row> -->
            <div v-show="showCard">
                <el-tabs v-model="activeName1">
                    <el-tab-pane label="产品物料构成" name="first">
                        <!-- <el-row :gutter="20">
                <div class="table-container" style="margin-bottom: 100px"> -->
                <el-table
                    :data="productCraftTableData"
                    row-key="id"
                    default-expand-all
                    border
                    style="width:100%"
                    :tree-props="{children:'children',hasChildren:'hasChildren'}"
                >
                    <el-table-column
                    prop="DH"
                    label="代号"></el-table-column>
                    <el-table-column
                    prop="MC"
                    label="名称"></el-table-column>
                    <el-table-column
                    prop="TH"
                    label="图号"></el-table-column>
                    <el-table-column
                    prop="GG"
                    label="规格"></el-table-column>
                    <el-table-column
                    prop="CZ"
                    label="材质"></el-table-column>
                </el-table>
                <!-- </div>
            </el-row> -->
                    </el-tab-pane>
                    <el-tab-pane label="产品工艺流程" name="second">
                        <!-- <el-row :gutter="20"> -->
                <el-table 
                        :data="productCraftFlowTableData1"
                        border
                        style="width: 100%"
                        >
                        <el-table-column
                            prop="JGSX"
                            label="加工顺序"
                            width="100">
                        </el-table-column>
                        <el-table-column
                            prop="GXMC"
                            label="工序名称"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SSDGXYX"
                            label="受上道工序影响"
                            
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SDprocess"
                            label="上道工序"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="SDGX"
                            label="首道工序"
                            
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GXSX"
                            label="工序属性"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="JGBM"
                            label="加工部门"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="JGJG"
                            label="加工价格"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="FPJG"
                            label="废品价格"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="DC"
                            label="单重"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="MDGX"
                            label="末道工序"
                    
                            width="120"></el-table-column>
                            <el-table-column
                            prop="XCGXSZ"
                            label="消除工序设置"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="WCL"
                            label="误差率%"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="DEGS"
                            label="定额工时"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GSDW"
                            label="工时单位"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="GJGX"
                            label="关键工序"
                            width="120"></el-table-column>
                            <el-table-column
                            prop="remark"
                            label="备注"
                            width="120"></el-table-column>
                </el-table>
            <!-- </el-row> -->
                    </el-tab-pane>
                </el-tabs>
               
            
            </div>
            
            </el-col>
            <!-- </el-row> -->
             </pane>
             </splitpanes>
        </el-tab-pane>
        <el-tab-pane label="产品结构清单" name="fourth">
        <el-row :gutter="20">
      <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
        <pane size="16">
          <el-col>
            <div class="head-container">
              <el-input v-model="deptName" placeholder="请输入材料" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
            </div>
            <div class="head-container">
              <el-tree :data="parentAccountName" :props="defaultProps" :expand-on-click-node="true"
              :filter-node-method="filterNode" ref="tree" default-expand-all highlight-current
              @node-click="handleNodeClick" />
            </div>
          </el-col>
        </pane>
        
        <pane size="84">
          <el-col>
              <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
                <el-form-item label="编号" prop="编号">
                  <el-input v-model="queryParams.编号" placeholder="请输入编号" clearable @keyup.enter.native="handleQuery" />
                </el-form-item>
                <el-form-item label="品名" prop="品名">
                  <el-input v-model="queryParams.品名" placeholder="请输入品名" clearable @keyup.enter.native="handleQuery" />
                </el-form-item>
                <el-form-item label="类别" prop="类别">
                  <el-input v-model="queryParams.类别" placeholder="请输入类别" clearable @keyup.enter.native="handleQuery" />
                </el-form-item>

                <el-form-item>
                  <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                  <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                </el-form-item>

              </el-form>
              
              <el-row :gutter="10" class="mb8">
                <!-- <el-col :span="1.5">
                  <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
                </el-col> -->
                <!-- <el-col :span="1.5">
                  <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
                    @click="handleUpdate">修改</el-button>
                </el-col> -->
                <!-- <el-col :span="1.5">
                  <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
                    @click="handleDelete">删除</el-button>
                </el-col> -->
                <el-col :span="1.5">
                  <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
                </el-col>
                <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
              </el-row>
              
        <el-tooltip placement="top">
          <div slot="content">点击任意一行列，即可在下方查看清单组成信息记录</div>
        <el-table :data="productData" v-loading="loading" :row-class-name="rowClassName" @row-click="showTab">
          <el-table-column prop="productNo" align="center" label="产品代号" />
          <el-table-column prop="img" align="center" label="图片">
            <template slot-scope="scope">
              <image-preview :src="scope.row.img" :width="50" :height="50" />
            </template>
          </el-table-column>
           <el-table-column prop="productName" align="center" label="产品名称" />
          <el-table-column prop="productImg" align="center" label="产品图号" />
          <el-table-column prop="productSpec" align="center" label="产品规格" />
          <el-table-column label="操作" align="center" width="150" fixed="right">
            <template slot-scope="scope">
              <el-button type="text" size="mini" @click="handleUpdateProductMix( scope.row)">修改</el-button>
              <el-button type="text" size="mini" @click="handleDeleteProductMix( scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination  :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getList" />
       </el-tooltip> 
          
       
         <div v-if="showCardProductMix">
          <h2 align="center">{{ productName }}清单组成</h2>
          <!-- <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddMaterial">新增</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
                @click="handleupdateMaterial">修改</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
                @click="handledeleteMaterial">删除</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
          </el-row> -->

          <el-form ref="form" :disabled="isEdit" :model="form" :rules="rules" label-width="100px">
            <el-row>
              <el-col :span="8">
                <el-form-item label="产品代号" prop="productNo">
                  <el-input v-model="form.productNo" placeholder="请输入产品代号" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品名称" prop="productName">
                  <el-input v-model="form.productName" placeholder="请输入产品名称" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品规格" prop="productSpec">
                  <el-input v-model="form.productSpec" placeholder="产品规格" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="8">
                <el-form-item label="主单位" prop="mainUnit">
                  <el-input v-model="form.mainUnit" placeholder="请输入主单位" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="副单位" prop="subUnit">
                  <el-input v-model="form.subUnit" placeholder="请输入副单位" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="转化率(%)" prop="conversionRate">
                  <el-input v-model="form.conversionRate" placeholder="请输入损耗率" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            
            <el-row>
              <el-col :span="8">
                <el-form-item label="修改人" prop="modifyUser">
                  <el-input v-model="form.modifyUser" placeholder="请输入修改人" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="修改时间" prop="modifyTime">
                  <el-input v-model="form.modifyTime" placeholder="请输入修改时间" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="BOM编号" prop="bomNo">
                  <el-input v-model="form.bomNo" placeholder="请输入BOM编号" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            
            <el-row>
              <el-col :span="8">
                <el-form-item label="单件成本" prop="unitCost">
                  <el-input v-model="form.unitCost" placeholder="请输入单件成本" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="单件加工费" prop="unitProcessCost">
                  <el-input v-model="form.unitProcessCost" placeholder="请输入单件加工费" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="版本号" prop="version">
                  <el-input v-model="form.version" placeholder="请输入版本号" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            
          </el-form>
          
          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddMaterial">新增子件</el-button>
            </el-col>
              <el-col el-col :span="1.5">  
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
              </el-col>
          </el-row>
          
          <el-table 
          :row-style="rowStyle" :data="materialData" style="width: 100%;
          margin-bottom: 20px;" v-loading="loading" row-key="productNo" border 
            :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" @selection-change="handleSelectionChange">
            <el-table-column type="expand" align="center" label="子件">
              <!-- <el-table-column type="selection" width="55" align="center" /> -->
              <el-table-column prop="parentProductNo" align="center" label="上级产品代号" />
              <el-table-column prop="productNo" align="center" label="产品代号" />
              <el-table-column prop="img" align="center" label="产品图片">
                <template slot-scope="scope">
                  <image-preview :src="scope.row.img" :width="50" :height="50" />
                </template>
              </el-table-column>
              <el-table-column prop="productName" align="center" label="产品名称" />
              <el-table-column prop="color" align="center" label="颜色" />
              <el-table-column prop="size" align="center" label="规格" />
              <el-table-column prop="type" align="center" label="类型(物品类型)" />
              <el-table-column prop="unit" align="center" label="单位" />
              <el-table-column prop="process" align="center" label="领用工序" />
              <el-table-column prop="mainUnit" align="center" label="主单位用量" />
              <el-table-column prop="subUnit" align="center" label="副单位用量" />
              <el-table-column prop="lossRate" align="center" label="损耗率(%)" />
              <el-table-column prop="department" align="center" label="领用部门" />
            </el-table-column>
            <el-table-column label="操作" align="center" width="150" fixed="right">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="handleupdateMaterial( scope.row)">修改</el-button>
                <el-button type="text" size="mini" @click="handledeleteMaterial( scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
         </div>
              
          </el-col>
        </pane>
      </splitpanes>
    </el-row>
    
     <el-dialog :title="titleProductMix" :visible.sync="openProductMix" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="产品代号" prop="productNo">
          <el-input v-model="form.productNo" placeholder="请输入产品代号" />
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入产品名称"  />
        </el-form-item>
        <el-form-item label="产品图号" prop="productImg">
          <el-input v-model="form.productImg" placeholder="请输入产品图号"  />
        </el-form-item>
        <el-form-item label="产品规格" prop="productSpec">
          <el-input v-model="form.productSpec" placeholder="产品规格" />
        </el-form-item>
        <el-form-item label="图片" prop="img">
          <ImageUpload v-model="form.img" :limit="1"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitFormProductMix">确 定</el-button>
          <el-button @click="cancelProductMix">取 消</el-button>
      </div>
     </el-dialog>
     
     <!-- 材料  -->
      <el-dialog :title="titleMaterial" :visible.sync="openMaterial" width="800px" append-to-body>
        <el-form ref="formMaterial" :model="formMaterial" :rules="rulesMaterial" label-width="100px">
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="上级产品代号" prop="parentProductNo">
                <el-input v-model="formMaterial.parentProductNo" style="width: 240px;" disabled placeholder="请输入上级产品代号" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="产品代号" prop="productNo">
                <el-select v-model="formMaterial.productNo"  style="width: 240px;" @input="handleSelectProductNo" placeholder="请选择产品代号">
                  <el-option label="1001     产品1" value="1001"></el-option>
                  <el-option label="1002     产品2" value="1002"></el-option>
                  <el-option label="1003   产品3" value="1003"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="产品名称" prop="productName">
                <el-input v-model="formMaterial.productName" style="width: 240px;" placeholder="请输入产品名称" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="颜色" prop="color">
                <el-input v-model="formMaterial.color" style="width: 240px;" placeholder="请输入颜色" />
              </el-form-item>
            </el-col>
          </el-row>
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="规格" prop="spec">
                <el-input v-model="formMaterial.spec" style="width: 240px;" placeholder="请输入规格" />
                <!-- <el-select v-model="formMaterial.size" style="width: 240px;" placeholder="请选择规格">
                  <el-option label="" value="规格1"></el-option>
                  <el-option label="规格2" value="规格2"></el-option>
                  <el-option label="规格3" value="规格3"></el-option>
                </el-select> -->
              </el-form-item>
            </el-col>
              <el-col :span="12">
               <el-form-item label="类型" prop="type">
                <el-select v-model="formMaterial.type" style="width: 240px;" placeholder="请选择类型">
                  <el-option label="原材料" value="原材料"></el-option>
                  <el-option label="辅料" value="辅料"></el-option>
                  <el-option label="半成品" value="半成品"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="12">
              <el-form-item label="单位" prop="unit">
                 <el-select v-model="formMaterial.unit" style="width: 240px;" placeholder="请选择单位">
                  <el-option label="件" value="件"></el-option>
                  <el-option label="克" value="克"></el-option>
                  <el-option label="公斤" value="公斤"></el-option>
                  <el-option label="毫升" value="毫升"></el-option>
                  <el-option label="升" value="升"></el-option>
                  <el-option label="张" value="张"></el-option>
                  <el-option label="支" value="支"></el-option>
                  <el-option label="个" value="个"></el-option>
                  <el-option label="套" value="套"></el-option>
                  <el-option label="箱" value="箱"></el-option>
                  <el-option label="立方米" value="立方米"></el-option>
                  <el-option label="平方米" value="平方米"></el-option>
                 </el-select>
              </el-form-item>             
            </el-col> -->
          </el-row>
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="领用工序" prop="process">
                <el-select v-model="formMaterial.process" style="width: 240px;" placeholder="请选择领用工序">
                  <el-option label="制作" value="制作"></el-option>
                  <el-option label="加工" value="加工"></el-option>
                  <el-option label="包装" value="包装"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="主单位用量" prop="mainUnit">
                <el-input v-model="formMaterial.mainUnit" style="width: 240px;" placeholder="请输入主单位用量" />
              </el-form-item>
            </el-col>
          </el-row>
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="副单位用量" prop="subUnit">
                <el-input v-model="formMaterial.subUnit" style="width: 240px;" placeholder="请输入副单位用量" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="损耗率(%)" prop="lossRate">
                <el-input v-model="formMaterial.lossRate" style="width: 240px;" placeholder="请输入损耗率" />
              </el-form-item>
            </el-col>
          </el-row>
          
          <el-row>
            <el-col :span="12">
              <el-form-item label="领用部门" prop="department">
                <el-select v-model="formMaterial.department" style="width: 240px;" placeholder="请选择领用部门">
                  <el-option label="包装车间" value="包装车间"></el-option>
                  <el-option label="成型车间" value="成型车间"></el-option>
                  <el-option label="加工车间" value="加工车间"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="半成品" prop="halfProduct" v-if= "flag">
                <el-select v-model="formMaterial.halfProduct" style="width: 240px;" placeholder="请选择半成品">
                  <el-option label="盘子" value="盘子"></el-option>
                  <el-option label="瓶子" value="瓶子"></el-option>
                  <el-option label="袋子" value="袋子"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            
          </el-row>
          
          <el-row>
          
            <el-col :span="12">
              <el-form-item label="产品图片" prop="img">
                <ImageUpload v-model="formMaterial.img" :limit="1"/>
              </el-form-item>
            </el-col>
          </el-row>
          
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitFormMaterial">确 定</el-button>
          <el-button @click="cancelMaterial">取 消</el-button>
        </div>
      </el-dialog>
        </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script>
import { Splitpanes, Pane } from "splitpanes";
import "splitpanes/dist/splitpanes.css";
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
   export default {
    components: {  Splitpanes, Pane, Treeselect },
    data() {
        return {
          activeName: 'first',
          activeName1: 'first',
          //弹出层标题
          title:"",
          titleProcess:"",
          titleProductMix:"",
          titleMaterial:"",
          //是否显示弹出层
          open:false,
          openProcess:false,
          openProductMix:false,
          openMaterial:false,
          //表单参数
          GXDialog: {},
          processDialog:{},
          form:{},
          formMaterial:{},
          //弹窗表单验证规则
          rules:{},
          rulesMaterial: {},
          total: 0,
          showSearch:true,
          single:false,
          multiple: false,
          tableData: [],
          isEdit: false,
          showCardProductMix: true,
          flag: false,
          deptName: '',

          //模拟数据
          productList:[{
        //productNo: '1001',
        productName: '产品1',
        color: '红色',
        process: '制作',
        mainUnit: '100',
        subUnit: '50',
        lossRate: '10',
        department: '包装车间',
        img: 'https://img.redocn.com/sheying/20160224/meiguihuazhi_5893058.jpg',
        halfProduct: '盘子',
        type: '原材料',
      },{
       // productNo: '1002',
        productName: '产品2',
        color: '蓝色',
        process: '加工',
        mainUnit: '100',
        subUnit: '50',
        lossRate: '10',
        department: '成型车间',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        halfProduct: '瓶子',
        type: '辅料',
      },{
        //productNo: '1003',
        productName: '产品3',
        color: '绿色',
        process: '包装',
        mainUnit: '100',
        subUnit: '50',
        lossRate: '10',
        department: '加工车间',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        halfProduct: '袋子',
        type: '半成品',
      }],
          productData1: [[{
        productNo: '10001',
        img: 'https://img.redocn.com/sheying/20160224/meiguihuazhi_5893058.jpg',
        productName: '产品1',
        productImg: '10001',
        productSpec: '规格1',
      }, {
        productNo: '10002',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        productName: '产品2',
        productImg: '10002',
        productSpec: '规格2',
      }, {
        productNo: '10003',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        productName: '产品3',
        productImg: '10003',
        productSpec: '规格3',
      }],[{
        productNo: '10004',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        productName: '产品4',
        productImg: '10004',
        productSpec: '规格4',
      }, {
        productNo: '10005',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        productName: '产品5',
        productImg: '10005',
        productSpec: '规格5',
      }, {
        productNo: '10006',
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        productName: '产品6',
        productImg: '10006',
        productSpec: '规格6',
      }]],
      productData: [],
      //材料数据
      materialData:[{
          parentProductNo: '10001',
          productNo: '100011',
          productName: '塑胶',
          color: '红色',
          size: '规格1',
          type: '原材料',
          process: '领用工序1',
          mainUnit: '100',
          subUnit: '50',
          lossRate: '10',
          department: '领用部门1',
          halfProduct: '盘子',
          img: 'https://img.redocn.com/sheying/20160224/meiguihuazhi_5893058.jpg',
        },
        {
          parentProductNo: '10001',
          productNo: '100012',
          productName: '密胺',
          color: '蓝色',
          size: '规格2',
          type: '辅料',
          process: '领用工序2',
          mainUnit: '100',
          subUnit: '50',
          lossRate: '10',
          department: '领用部门2',
          halfProduct: '瓶子',
          img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          children:[{
            parentProductNo: '100012',
            productNo: '1000121',
            productName: '塑胶',
            color: '红色',
            size: '规格1',
            type: '原材料',
            process: '领用工序1',
            mainUnit: '100',
            subUnit: '50',
            lossRate: '10',
            department: '领用部门1',
            halfProduct: '盘子',
            img: 'https://img.redocn.com/sheying/20160224/meiguihuazhi_5893058.jpg',
            isSon: true,
          },
          {
            parentProductNo: '100012',
            productNo: '1000122',
            productName: '密胺',
            color: '蓝色',
            size: '规格2',
            type: '辅料',
            process: '领用工序2',
            mainUnit: '100',
            subUnit: '50',
            lossRate: '10',
            department: '领用部门2',
            halfProduct: '瓶子',
            img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
            isSon:true,
          }]
      }],
      parentAccountName: [{
        label: '所有类别',
        children: [
          {
            label: '半成品类',
            children: [
              {
                label: '塑胶半成品类'
              },
              {
                label: '密胺半成品类'
              }]
          },
          {
            label: '成品类',
            children: [{
              label: '塑胶成品类'
            }, {
              label: '密胺成品类'
            }]
          }]
      }],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
          //消除工序设置
          XCGXSZOptions:[{
            dictLabel:'入库消除工序',
            dictValue:'入库消除工序',
          },{
            dictLabel:'出入库都消除工序',
            dictValue:'出入库都消除工序',
          }],
          //所属车间
          SSCJOptions:[{
            dictValue:'机加工中心',
            dictLabel:'机加工中心'
          },{
            dictValue:'电镀组',
            dictLabel:'电镀组'
          },{
            dictValue:'钳工组',
            dictLabel:'钳工组'
          },{
            dictValue:'密胺生产部',
            dictLabel:'密胺生产部'
          },{
            dictValue:'花纸车间',
            dictLabel:'花纸车间'
          },{
            dictValue:'成型车间',
            dictLabel:'成型车间'
          },{
            dictValue:'研磨车间',
            dictLabel:'研磨车间'
          },{
            dictValue:'黄岩成型车间',
            dictLabel:'黄岩成型车间'
          },{
            dictValue:'黄岩研磨车间',
            dictLabel:'黄岩研磨车间'
          },{
            dictValue:'注塑生产部',
            dictLabel:'注塑生产部'
          },{
            dictValue:'包装车间',
            dictLabel:'包装车间'
          },{
            dictValue:'内销包装',
            dictLabel:'内销包装'
          },{
            dictValue:'外销包装',
            dictLabel:'外销包装'
          },{
            dictValue:'塑料印花',
            dictLabel:'塑料印花'
          },{
            dictValue:'采购部',
            dictLabel:'采购部'
          },{
            dictValue:'江西分厂成型车间',
            dictLabel:'江西分厂成型车间'
          },{
            dictValue:'江西分厂研磨车间',
            dictLabel:'江西分厂研磨车间'
          }],
          
          //加工顺序
          JGSXOptions:[{
            dictValue:'1',
            dictLabel:'1'
          },{
            dictValue:'2',
            dictLabel:'2'
          }],
          //所属类别
          SSLBTreeOptions:[{
            value:'半成品类',
            label:'半成品类',
            children:[{
                value:'塑胶半成品类',
                label:'塑胶半成品类',
            },{
                value:'密胺半成品类',
                label:'密胺半成品类',
            }]
          },{
            value:'成品类',
            label:'成品类',
            children:[{
                value:'塑胶成品类',
                label:'塑胶成品类',
            },{
                value:'密胺成品类',
                lable:'密胺成品类',
            }]
          }],
          //加工部门
          JGBMTreeOptions:[{
            value:'本厂部门',
            label:'本厂部门',
            children:[{
                value:'企划部',
                label:'企划部',
            },{
                value:'财务部',
                label:'财务部',
            },{
                value:'总经办',
                label:'总经办',
            },{
                value:'销售部',
                label:'销售部',
            }]
          },{
            value:'外协商',
            label:'外协商',
            children:[{
                value:'原料类供应商',
                label:'原料类供应商',
            },{
                value:'辅料类供应商',
                label:'辅料类供应商',
            },{
                value:'五金类供应商',
                label:'五金类供应商',
            },{
                value:'外协加工厂',
                label:'外协加工厂',
            }]
          }],
          //隶属于
          LSYTreeOptions:[{
            value:'塑胶工序',
            label:'塑胶工序',
            children: [{
                value:'注塑',
                label:'注塑',
            }]
          },{
            value:'密胺工序',
            label:'密胺工序',
            children:[{
                value:'外协加工',
                label:'外协加工',
            }]
          },{
            value:'包装工序',
            label:'包装工序',
            children:[{
                value:'包装',
                label:'包装',
            }]
          }],
          //工序属性
          GXSXOptions:[{
            dictValue:'本厂',
            dictLabel:'本厂'
          },{
            dictValue:'外加工',
            dictLabel:'外加工'
          },{
            dictValue:'外生产',
            dictLabel:'外生产'
          }],
         SSDGXYXOptions: [{
            dictValue:'是',
            dictLabel:'是'
         },{
            dictValue:'否',
            dictLabel:'否'
         }],
        processDataTree: [{
          label:'工序资料树',
          children:[{
            label:'塑胶工序',
            children:[{
                label:'注塑',
            },{
                label:'印花',
            },{
                label:'超声波焊接'
            },{
                label:'移印',
            },{
                label:'丝网印',
            },{
                label:'热转印',
            },{
                label:'15/袋热封扣',
            },{
                label:'自动机热转印',
            },{
                label:'套袋子（丝网印）',
            }]
          },{
            label:'密胺工序',
            children:[{
                label:'外协加工',
            },{
                label:'磨边',
            },{
                label:'抛光',
            },{
                label:'磨孔',
            },{
                label:'烘花',
            },{
                label:'夹花',
            },{
                label:'粘花',
            },{
                label:'订花',
            },{
                label:'刷花',
            },{
                label:'冲/剪花',
            },{
                label:'成型',
            },]
          },{
            label:'包装工序',
            children:[{
                label:'包装',
            },{
                label:'装内盒',
            },{
                label:'装外盒',
            },{
                label:'入中包装袋',
            },{
                label:'装彩盒',
            },{
                label:'入PVC盒',
            }]
          }]
        }],
        baseCraftDataTree: [{
                    label:'基础工艺资料树',
                    children:[{
                        label:'塑胶半成品加工工艺',
                    },{
                        label:'密胺半成品加工工艺',
                    },{
                        label:'成品加工工艺',
                    }]
                }],
        productCraftDataTree: [{
            label:'所有类别',
            children: [{
                label:'半成品类',
                children:[{
                    label:'塑胺半成品类',
                },{
                    label:'密胺半成品类',
                },]
            },{
                label:'成品类',
                children: [{
                    label:'塑胺成品类',
                },{
                    label:'密胺成品类',
                }]
            }]
        }],
        productCraftFlowTableData:[],
        // productCraftFlowTableData: [{
        //     JGSX:'1',
       
        //     GXMC:'烘花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'2',
       
        //     GXMC:'刷花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',

        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'3',
       
        //     GXMC:'夹花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'4',
       
        //     GXMC:'订花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'5',
       
        //     GXMC:'冲/剪花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'6',
       
        //     GXMC:'粘花',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'花纸车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'7',
       
        //     GXMC:'成型',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'成型车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // },{
        //     JGSX:'8',
       
        //     GXMC:'磨边',
        
        //     SSDGXYX:'ture',
      
        //     SDprocess:'',
    
        //     SDGX:'ture',
       
        //     GXSX:'本厂',
        //     JGBM:'研磨车间',
      
        //     JGJG:'',
     
        //     FPJG:'',
        
        //     DC:'',
        
        //     MDGX:'ture',
        
        //     XCGXSZ:'',
       
        //     WCL:'0',
       
        //     DEGS:'0',
       
        //     GSDW:'',
       
        //     GJGX:'',
        
        //     remark:'',
        // }],
        productCraftData:[],
        // productCraftData: [{
        //     CPDH:'YL893',
        //     CPMC:'四方三格盘',
        //     CPTH:'',
        //     CPGG:'0*0*0',
        //     GXStatus:'已建',
        // }],
        productCraftFlowTableData1:[{
           
            JGSX:'1',
       
            GXMC:'烘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'2',
       
            GXMC:'刷花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',

            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'3',
       
            GXMC:'夹花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'4',
       
            GXMC:'订花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'5',
       
            GXMC:'冲/剪花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'6',
       
            GXMC:'粘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'7',
       
            GXMC:'成型',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'成型车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'8',
       
            GXMC:'磨边',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'研磨车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        }
        ],
        productCraftTableData: [{
            id:1,
            DH:'LG250',
            MC:'LG250光粉',
            TH:'',
            GG:'广华LG250/松亿',
            CZ:'',
            children:[{
                id:11,
                DH:'LG250',
                MC:'LG250光粉',
                TH:'',
                GG:'广华LG250/松亿',
                CZ:'',
            }]
        },{
            id:2,
            DH:'LG250',
            MC:'LG250光粉',
            TH:'',
            GG:'广华LG250/松亿',
            CZ:'',
            children:[{
                id:21,
                DH:'LG250',
                MC:'LG250光粉',
                TH:'',
                GG:'广华LG250/松亿',
                CZ:'',
            }]
        },{
            id:3,
            DH:'LG250',
            MC:'LG250光粉',
            TH:'',
            GG:'广华LG250/松亿',
            CZ:'',
            children:[{
                id:31,
                DH:'LG250',
                MC:'LG250光粉',
                TH:'',
                GG:'广华LG250/松亿',
                CZ:'',
                children:[{
                    id:311,
                    DH:'LG250',
                    MC:'LG250光粉',
                    TH:'',
                    GG:'广华LG250/松亿',
                    CZ:'',
                },{
                    id:312,
                    DH:'LG250',
                    MC:'LG250光粉',
                    TH:'',
                    GG:'广华LG250/松亿',
                    CZ:'',
                }]
            }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        },
        
        processData: {
            GXMC:'',
            FJDH:'',
            JGSX:'',
            SSCJ:'',
            MRCK:'',
            GXSX:'',
            ZPDJ:'',
            CPDJ:'',
            FPDJ:'',
            LSY:'',
            CJGX:'',
        },
        baseCraftTable: {
                    GYBH:'',
                    GYMC:'',
                    SSLB:'',
        },
        queryParamsCPGY: {
            CPTJ:'',
        },
        showCard:true,
       
      };
    },
    mounted() {
    console.log(this.parentAccountName[0].children[0]);
    this.handleNodeClick(this.parentAccountName[0].children[0])
  },
  watch: {
    // 监听数据的变化, 判断是否是子数据
    materialData(value) {
      console.log(value)
      this.materialData.filter(item => {
        console.log(item)
        var children = item.children;
        children.filter(i => {
          i.parentMemberAccount = item.memberAccount
          i.isSon = true;
        })
      })
    }
  },
    methods: {
      
      //显示高亮
        rowClassName({ row }) {
          return row.productNo === this.productNo ? 'selected-row' : ''; // 判断是否选中
        },
      
        // 弹窗
    rowStyle({ row }) {
      if(row.isSon){
        return { background: 'skyblue' }
      }else{
        return {}
      } 
    },
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
        //工序设置节点点击事件
      handleNodeClick1(data) {
        const name = data.label
        console.log(name);
        if(name == '注塑'){
            this.processData.GXMC = "塑胶"
            this.processData.SSCJ = "注塑生产部"
            this.processData.GXSX = "本厂"
            this.processData.LSY = "塑胶工序"
        }else if(name == '印花'){
            this.processData.GXMC = "印花"
            this.processData.SSCJ = "塑料印花"
            this.processData.GXSX = "本厂"
            this.processData.LSY = "塑胶工序"
        } 
         else{
            this.processData.GXMC = ""
            this.processData.SSCJ = ""
            this.processData.GXSX = ""
            this.processData.LSY = ""
        }
      },
      //工艺设置节点点击事件
      handleNodeClick2(data){
        const name = data.label
        console.log(name)
        if(name == '塑胶半成品加工工艺'){
            this.baseCraftTable.GYBH = '01'
            this.baseCraftTable.GYMC = '塑胶半成品加工工艺'
            this.baseCraftTable.SSLB = '半成品'
            
            this.productCraftFlowTableData = [{
            JGSX:'1',
       
            GXMC:'烘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'2',
       
            GXMC:'刷花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',

            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'3',
       
            GXMC:'夹花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'4',
       
            GXMC:'订花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'5',
       
            GXMC:'冲/剪花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'6',
       
            GXMC:'粘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'7',
       
            GXMC:'成型',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'成型车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'8',
       
            GXMC:'磨边',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'研磨车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        }]
        }else if(name == '密胺半成品加工工艺'){
            this.baseCraftTable.GYBH = '02'
            this.baseCraftTable.GYMC = '密胺半成品加工工艺'
            this.baseCraftTable.SSLB = '半成品'
            this.productCraftFlowTableData = [{
            JGSX:'1',
       
            GXMC:'烘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'2',
       
            GXMC:'刷花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',

            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'3',
       
            GXMC:'夹花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        }]
        }else if(name == '成品加工工艺'){
            this.baseCraftTable.GYBH = '03'
            this.baseCraftTable.GYMC = '成品加工工艺'
            this.baseCraftTable.SSLB = '成品'
            this.productCraftFlowTableData = [{
            JGSX:'1',
       
            GXMC:'烘花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'2',
       
            GXMC:'刷花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',

            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        },{
            JGSX:'3',
       
            GXMC:'夹花',
        
            SSDGXYX:'是',
      
            SDprocess:'',
    
            SDGX:'是',
       
            GXSX:'本厂',
            JGBM:'花纸车间',
      
            JGJG:'',
     
            FPJG:'',
        
            DC:'',
        
            MDGX:'是',
        
            XCGXSZ:'',
       
            WCL:'0',
       
            DEGS:'0',
       
            GSDW:'',
       
            GJGX:'',
        
            remark:'',
        }]
        }
        else{
            this.baseCraftTable.GYBH = ''
            this.baseCraftTable.GYMC = ''
            this.baseCraftTable.SSLB = ''
            this.productCraftFlowTableData = []
        }
      },
      //产品工艺节点点击事件
      handleNodeClick3(data) {
        const name = data.label
        console.log(name)
        if(name == '密胺成品类'){           
            this.productCraftData = [{
            CPDH:'YL893',
            CPMC:'四方三格盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL021909',
            CPMC:'长方碟',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL687',
            CPMC:'托盘三件套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL880',
            CPMC:'卫浴套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL11513',
            CPMC:'13寸椭圆波边盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL0101126',
            CPMC:'长方提手宽边托盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        }];this.showCard = true
        }else if (name == '塑胺半成品类'){
            this.productCraftData = [{
            CPDH:'YL021909',
            CPMC:'长方碟',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL687',
            CPMC:'托盘三件套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL880',
            CPMC:'卫浴套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL11513',
            CPMC:'13寸椭圆波边盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL0101126',
            CPMC:'长方提手宽边托盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        }];
        this.showCard = true
        }else if (name == '密胺半成品类'){
            this.productCraftData = [{
            CPDH:'YL893',
            CPMC:'四方三格盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL687',
            CPMC:'托盘三件套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL880',
            CPMC:'卫浴套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL11513',
            CPMC:'13寸椭圆波边盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL0101126',
            CPMC:'长方提手宽边托盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        }];
        this.showCard = true
        }else if (name == '塑胺成品类'){
            this.productCraftData = [{
            CPDH:'YL687',
            CPMC:'托盘三件套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL880',
            CPMC:'卫浴套',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL11513',
            CPMC:'13寸椭圆波边盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        },{
            CPDH:'YL0101126',
            CPMC:'长方提手宽边托盘',
            CPTH:'',
            CPGG:'0*0*0',
            GXStatus:'已建',
        }];
        this.showCard = true
        }
        else {
            this.productCraftData = []
            this.showCard = false
        }
      },
      handleNodeClick(data) {
      this.tableData = data
      if(data.label === '半成品类'){
        this.productData = this.productData1[0]
        this.flag = false
    }
      else if(data.label === '成品类'){
        this.productData = this.productData1[1]
        this.flag = true
      }
    },
      handleCellClick(){
        console.log(11111);
        this.showCardProductMix = true
      },
      getList(){ },
      handleAddProductMix() {
        this.open = true;
        this.title = '新增成品信息';
        this.form = {};
      },
      handleUpdateProductMix(row) {
      this.form = row;
      console.log(row);
      this.open = true;
      this.title = '修改成品信息';
    },
    handleDeleteProductMix(row) {
      this.$confirm('确认删除产品列表')
      .then(() => {
          this.productData.splice(this.productData.indexOf(row), 1);
          this.$message.success('删除成功');
          this.showCardProductMix = false
      })
    },
    submitFormProductMix(){
        this.openProductMix = false;
    },
    cancelProductMix(){
        this.open = false;
    },
    handleAddMaterial() {
      this.resetForm();
      this.formMaterial.parentProductNo = this.productNo;
      this.titleMaterial = '新增材料信息';
      this.openMaterial = true;
    },
    handleupdateMaterial(row) {
      this.formMaterial = row;
      this.openMaterial = true;
      this.titleMaterial = '修改材料信息';
    },
    handledeleteMaterial(row) {
      this.$confirm('确认删除材料列表')
      .then(() => {
        this.materialData.splice(this.materialData.indexof(row),1)
      })
    },
    submitFormMaterial() {
      this.openMaterial = false;
    },
    cancelMaterial() {
      this.openMaterial = false;
    },
    // 重置表单
    resetForm() {
      this.formMaterial = {
        parentProductNo: '',
        productNo: '',
        productName: '',
        spec: '',
        color: '',
        size: '',
        type: '',
        process: '',
        mainUnit: '',
        subUnit: '',
        lossRate: '',
        department: '',
        halfProduct: '',
        img: '',
      }
    },
    showTab(row) {
      this.productName =  row.productName
      this.productNo = row.productNo
      this.form = row
      this.showCardProductMix = true;
    },
    handleQuery() { },
    resetQuery() { },
    handleExport() { },
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
     // 根据产品代号展示所有数据
     handleSelectProductNo(data){
      console.log(data);
      
      if(data =='1001'){
        this.$nextTick(() => {
          this.resetForm()
          this.formMaterial = this.productList[0]
        })
        
      }
      else if(data == '1002'){
        this.$nextTick(() => {
          this.resetForm()
        this.formMaterial = this.productList[1]
        })
      }
      else if(data == '1003'){
        this.$nextTick(() => {
          this.resetForm()
        this.formMaterial = this.productList[2]
        })
      }
      
      // this.formMaterial = this.productList.find(item => item.productNo == data)
      this.$nextTick(() => {
      this.formMaterial.parentProductNo = this.productNo;
      this.formMaterial.productNo = data;
      })
      
    },
      /* 新增按钮操作 */
      handleAdd() {
        // this.isView = false;
        // this.reset();
        this.open = true;
        this.title = "添加工序数据"; 
        this.GXDialog.JGSX = '';
      },
      handleAddProcess() {
        this.openProcess = true;
        this.titleProcess = "新增工序";

      },
    /* 修改按钮操作 */
    handleUpdate(row) {
        this.open = true;
        this.title = "修改工序数据";
        this.GXDialog.JGSX = row.JGSX;
    },
    // 取消按钮
    cancel() {
        this.open = false;
    },
    cancelProcess(){
        this.openProcess = false;
    },
    // 提交按钮
    submitForm() {
        this.open = false;
    },
    submitFormProcess() {
        this.openProcess = false;
    },
    // 删除按钮操作
    handleDelte(row) {

    }
    }
  };
</script>

<style>
.selected-row {
  background-color: yellow !important;
  /* 选中行的背景颜色 */
}
</style>
